package com.cjr.blog.service.impl;

import com.cjr.blog.pojo.Article;
import com.cjr.blog.dao.ArticleDao;
import com.cjr.blog.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: chenjianrong
 * @Description:
 * @Data: Create in 23:15 2020/2/5
 * @Modified By:
 */
@Service
public class ArticleServiceImpl implements ArticleService {

    @Autowired
    private ArticleDao articleDao;

    @Cacheable(cacheNames="articles")
    @Override
    public Page<Article> findAll(Integer Page, Integer size) {
        return articleDao.findAll(PageRequest.of(Page,size));
    }
}
